<template>
  <el-popover placement="top-start" width="300" trigger="hover">
    <div class="tip-container">
      <div
        v-show="data.photo"
        class="img-box"
        :style="`background-image:url(${data.photo})`"
      ></div>
      <span class="desc">{{ data.explain }}</span>
    </div>
    <div
      slot="reference"
      class="item"
      :class="{itemLong: data.basis_name.length > 7}"
    >
      {{ data.basis_name }}
    </div>
  </el-popover>
</template>
<script>
export default {
  props: {
    data: [Object]
  }
};
</script>
<style lang="scss" scoped>
.item {
  padding: 8px 0px;
  border-radius: 5px;
  background-color: #fff;
  margin-right: 10px;
  color: #333;
  border: 1px solid #ced0d8;
  box-sizing: border-box;
  width: 145px;
  text-align: center;
  margin-bottom: 8px;
  &:hover {
    color: #fff;
    background-color: #ffb03e;
  }
}
.itemLong {
  width: 300px;
}
.tip-container {
  .img-box {
    width: 135px;
    height: 136px;
    background-size: cover;
    background-position: center;
    overflow: hidden;
    border-radius: 5px;
    float: left;
    margin-right: 10px;
  }
  .desc {
    color: #a1a1a1;
    font-size: 12px;
  }
}
</style>
